package com.loonyhom.musicplayer.Tools;

import android.content.Context;
import android.content.SharedPreferences;

import com.loonyhom.musicplayer.Control.MusicApp;

public class PreferencesService {
	private static final String TAG = "PreferencesService";
	private static final String NAMESTRING = "MM";

	private static SharedPreferences getSharedPreferences() {
		return MusicApp.getContext().getSharedPreferences(NAMESTRING,
				Context.MODE_PRIVATE);
	}

	private static SharedPreferences.Editor getEditor() {
		return MusicApp.getContext()
				.getSharedPreferences(NAMESTRING, Context.MODE_PRIVATE).edit();
	}

	public static int getInt(String key) {
		return getSharedPreferences().getInt(key, 0);
	}

	public static void setValue(String key, int value) {
		SharedPreferences.Editor editor = getEditor();
		editor.putInt(key, value);
		editor.commit();
	}

	public static boolean getBoolean(String key) {
		return getSharedPreferences().getBoolean(key, false);
	}

	public static void setValue(String key, boolean value) {
		SharedPreferences.Editor editor = getEditor();
		editor.putBoolean(key, value);
		editor.commit();
	}
}
